class PartSalseDetailsController < ApplicationController
  def new
  	@part_salse_detail = PartSalseDetail.new
    @part_styles = PartStyle.all
  end

  def create
  	@part_salse_detail = PartSalseDetail.new post_params
    if @part_salse_detail.save
       redirect_to part_salse_path(:id =>@part_salse_detail.part_salse.id)
    else
      render :action => 'new'
    end
  end

  def destroy
    @part_salse_detail = PartSalseDetail.find params[:id]
    @part_salse_detail.destroy
    redirect_to part_salse_path(:id =>@part_salse_detail.part_salse.id)
  end

   def post_params
    params.require(:part_salse_detail).permit(*%w(part_salse_id part_id part_style_id qty))
  end
end
